Skip to content

perf(mobile): smooth workspace resume - #4760

Open
gabrielelpidio wants to merge 1 commit into
mainfrom
t3code/speed-up-reconnect-ui
Open

perf(mobile): smooth workspace resume#4760
gabrielelpidio wants to merge 1 commit into
mainfrom
t3code/speed-up-reconnect-ui

Conversation

@gabrielelpidio

@gabrielelpidio gabrielelpidio commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Problem

Reopening the mobile app could briefly reveal an incomplete workspace, reload a shell snapshot that was already cached, and insert temporary connection status into list layouts. Warm resumes therefore felt slower than necessary and could flash or shift content even when recovery was quick.

Fix

  • Track when each environment has finished reading its persisted shell cache. Keep the splash screen visible until appearance preferences and those caches are ready, with a 750 ms cap so startup cannot wait indefinitely.
  • Keep cached threads and projects visible while live state catches up.
  • When the server supports completion markers and a cached snapshot exists, resume the shell stream from that saved sequence instead of downloading another HTTP snapshot. Cold caches and older servers retain the existing full-snapshot fallback.
  • Render workspace connection status as an animated bottom overlay instead of placing it inside thread lists or empty states.
  • Delay transient connecting and synchronizing status by 350 ms so short recoveries do not flash. Offline, error, and disconnected states remain immediate.
  • Distinguish initial “Connecting” states from “Reconnecting” states and route empty-state actions to either Add environment or Environment settings as appropriate.

The connection supervisor is intentionally unchanged. Mobile foreground wakeups, probe timing, lease replacement, and retry behavior are owned by #4878 on main.

User impact

Warm app resumes retain useful workspace content, avoid a redundant snapshot request, and no longer move the interface when connection status appears or disappears.

Verification

  • 25 focused mobile and client-runtime tests
  • Targeted formatting and lint
  • @t3tools/client-runtime typecheck
  • @t3tools/mobile typecheck
  • Preview build and Metro bundle exercised on a physical iPhone

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for UI changes
  • I included a video for animation or timing changes

Note

Medium Risk
Touches mobile bootstrap timing, shell stream resumption semantics, and workspace connection UI; incorrect hydration or cursor resume could show stale data or flash wrong chrome, but connection supervisor behavior is intentionally unchanged.

Overview
Startup keeps the splash screen up until saved environment shell caches finish hydrating (or the catalog fails), capped at 750 ms, so the first frame can show cached threads instead of an empty shell.

Shell sync in client-runtime resumes WebSocket subscriptions from the cached snapshot sequence when the server supports completion markers, skipping redundant HTTP shell downloads on warm cache and app foreground. Cold caches and older servers still use the HTTP snapshot path. cacheHydrated / areShellCachesHydrated track per-environment cache reads for bootstrap gating.

Connection status UI moves to a floating overlay (WorkspaceConnectionStatusOverlay) on home and the thread sidebar so reconnect/sync banners do not push lists or empty states. Transient connecting/sync states are delayed 350 ms; offline and errors show immediately. Labels distinguish Connecting vs Reconnecting, and empty-state actions route to add environment or environment settings when appropriate.

Reviewed by Cursor Bugbot for commit 06c7cdc. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Smooth mobile reconnect UI and resume shells from cached snapshots

  • Environments with a cached shell snapshot now resubscribe using the cached cursor and request a completion marker, skipping redundant HTTP snapshot downloads on reconnect.
  • A new WorkspaceConnectionStatusOverlay replaces inline connection status in HomeScreen and ThreadNavigationSidebar, positioning the status banner as a floating overlay to avoid layout shifts.
  • Transient reconnect states are deferred 350ms before showing the overlay to prevent brief flashes; offline/error states appear immediately.
  • The splash screen in App.tsx now waits until appearance preferences are ready and either all shell caches are hydrated or a 750ms budget elapses before dismissing.
  • Connection status labels now distinguish initial 'Connecting' from 'Reconnecting' based on each environment's prior connection state.
📊 Macroscope summarized 06c7cdc. 6 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.


Model: GPT-5.6 Sol
Harness: Codex in T3 Code

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc3ab8c4-7b88-44c4-ba83-7be5cf89bdb0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/speed-up-reconnect-ui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 28, 2026
Comment thread apps/mobile/src/App.tsx Outdated
Comment thread apps/mobile/src/features/home/HomeScreen.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR introduces significant changes to mobile app startup timing, connection status UI behavior, and shell synchronization strategy. Combined with unresolved review comments identifying potential UI bugs (overlay obscuring content, async state timing issues), these changes warrant human review.

You can customize Macroscope's approvability policy. Learn more.

@gabrielelpidio
gabrielelpidio force-pushed the t3code/speed-up-reconnect-ui branch from 7e7f593 to 06c7cdc Compare July 30, 2026 18:34
@gabrielelpidio gabrielelpidio changed the title Speed up mobile reconnect UI and shell resumption Smooth mobile reconnect UI and resume cached shells Jul 30, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High

paddingBottom: Math.max(insets.bottom, 16) + 16,

The persistent connection status overlay (WorkspaceConnectionStatusOverlay) floats above the bottom of the thread list, but the list's contentContainerStyle.paddingBottom is not increased to compensate. When an offline/error state persists and the user scrolls to the bottom, the last thread row or empty-state content remains partially obscured by the overlay and its tap target is unreachable. Add bottom clearance to the list content padding so the last row can scroll fully above the overlay.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx around line 1104:

The persistent connection status overlay (`WorkspaceConnectionStatusOverlay`) floats above the bottom of the thread list, but the list's `contentContainerStyle.paddingBottom` is not increased to compensate. When an offline/error state persists and the user scrolls to the bottom, the last thread row or empty-state content remains partially obscured by the overlay and its tap target is unreachable. Add bottom clearance to the list content padding so the last row can scroll fully above the overlay.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 06c7cdc. Configure here.

return () => clearTimeout(timeout);
}, [presentation, presented]);

if (!presented) return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlay shows after status hidden

Medium Severity

The WorkspaceConnectionStatusOverlay's presented state, which controls its visibility, updates asynchronously in useEffect. This can cause the overlay to briefly appear when it should be hidden, or delay its appearance/disappearance, due to a mismatch with the immediate workspaceConnectionStatusPresentation state.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 06c7cdc. Configure here.

state={props.catalogState}
onPress={props.onOpenEnvironments}
variant="sidebar"
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty state shows duplicate spinners

Low Severity

The empty-state ActivityIndicator no longer checks whether connection status is shown. During a deferred connecting load, the empty copy still spins and, after 350ms, WorkspaceConnectionStatusOverlay adds a second spinner for the same recovery state.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 06c7cdc. Configure here.

@gabrielelpidio gabrielelpidio changed the title Smooth mobile reconnect UI and resume cached shells perf(mobile): smooth workspace resume Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant